package com.fwmagic.dp._6._6_3;

public class Main {
    public static void main(String[] args) {
        Subject subject = new RealSubject();

      /*  //定义主题的代理
        Subject proxy = DynamicProxy.newProxyInstance(
                subject.getClass().getClassLoader(),
                subject.getClass().getInterfaces(),
                new MyInvocationHandler(subject));*/

        Subject proxy = SubjectDynamicProxy.newProxyInstance(subject);

        //代理的行为
        proxy.doSomething("haha");
    }
}
